package bishizhuanyong.京东;

import java.util.Arrays;
import java.util.Scanner;

public class jingdong {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        int n = s.nextInt();
        int[] num=new int[n];
        for (int i=0;i<n;i++)
            num[i]=s.nextInt();
        int[] count=new int[10000];
        count[0]=0;
        count[1]=1;
        for (int i=2;i<10000;i++){
            int rn=i+1;
            int min_count=1+count[i-1];
            for (int j=2;j<rn;j++){
                if (rn%j==0) {
                    min_count = Math.min(min_count, 1 + count[j - 1] + count[rn / j - 1]);
                }
            }
            count[i]=min_count;
        }
        int res=0;
        for (int i=0;i<num.length;i++){
            res+=count[num[i]-1];
        }
        System.out.println(res);
    }
}

/*
Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a=new int[n];
        for (int i=0;i<a.length;i++){
            a[i]=sc.nextInt();
        }
        Arrays.sort(a);
        int index=-1;
        for (int i=a.length-2;i>=0;i--){
            if (a[i]!=a[i+1]){
                index=i;
                break;
            }
        }
        System.out.println(index+1);
 */
